"""
主题: 创建不调用init方法的实例
问题: 你想创建一个实例，但是希望绕过执行 __init__() 方法。
提示 : 
"""

from time import localtime

class Date:
    def __init__(self, year, month, day):
        self.year = year
        self.month = month
        self.day = day

    @classmethod
    def today(cls):
        d = cls.__new__(cls)
        t = localtime()
        d.year = t.tm_year
        d.month = t.tm_mon
        d.day = t.tm_mday
        return d

def recipe1():
    data = {'year': 2012, 'month': 8, 'day': 29}
    d = Date.__new__(Date)
    for key, value in data.items():
        setattr(d, key, value)
    print(d.year, d.month, d.day)
 
def recipe2():
    print(f"{Date.today() = }")

def main():
    print('recipe1'.center(20, '*'))
    recipe1()
    print('recipe2'.center(20, '*'))
    recipe2()

if __name__ == '__main__':
    main()                  